<?php
/**
 * Created by PhpStorm.
 * User: yellow
 * Date: 2019/5/27
 * Time: 18:45
 */

namespace app\admin\controller;


use app\admin\logic\RegionLogic;
use think\facade\Request;

class Region extends Base
{

    private $regionLogic;

    public function __construct()
    {
        parent::__construct();
        $this->regionLogic = new RegionLogic();
    }

    public function index(){
        return $this->fetch();
    }

    public function ajaxIndex(){
        $parentId = Request::post('nodeId', 0);
        $regionList = $this->regionLogic->regionList($parentId);
        return json($regionList);
    }

    /**
     * @return \think\response\Json
     */
    public function handle(){
        $data = Request::post('');
        $res = $this->regionLogic->handle($data);
        return json($res);
    }

}